fix(core/chat): surface DNS/network guidance on stream errors (#377)#386
Open
fix(core/chat): surface DNS/network guidance on stream errors (#377)#386
Conversation
- add optional `current_date` field to `EnvironmentContext` so turn context carries ISO dates - serialize `<current_date>` tags and extend comparisons/tests to tolerate deterministic values - cover default date formatting with new unit tests
- reject cached version.json written by the upstream repo so we don't keep prompting for 0.50.0 - stamp new cache entries with the just-every/code origin to avoid future mixups - add regression tests covering legacy and current cache formats
- detect reqwest connect/timeout failures while starting model streams and wrap them with actionable hints - add DNS-specific guidance so users can spot resolver misconfigurations (e.g., empty /etc/resolv.conf) - cover hint detection with lightweight unit tests
zemaj
commented
Nov 6, 2025
Author
zemaj
left a comment
There was a problem hiding this comment.
Summary:
- Expanded DNS/connect error classification so
CodexErr::Streamsurfaces actionable guidance instead of opaque reqwest errors. - Extended
dns_resolution_hintcoverage (nodename/servname, getaddrinfo failures, Windows host errors) and guarded against empty error-chain messages. - Added targeted unit tests for the hint matcher and error-chain walker.
Tests:
cargo test -p code-core chat_completions::tests::dns_hint_matches_common_messages -- --nocapturecargo test -p code-core deepest_error_message_handles_empty_source_messages -- --nocapture./build-fast.sh
Risks:
- Consider adding jitter/backoff tuning for connect retries and auditing downstream consumers that rely on
CodexErr::ReqwestvsCodexErr::Stream. - Full
cargo test -p code-core --testsflakes locally on macOS due to/private/varvs/varpath expectations incustom_prompts_discovery; unrelated to these changes.
zemaj
commented
Nov 6, 2025
Author
zemaj
left a comment
There was a problem hiding this comment.
Summary:
- Centralized network/DNS guidance helpers in
code-rs/core/src/error.rsand wired them into both chat and responses SSE paths so retries surface actionable messages for timeouts, DNS failures, TLS errors, and connection resets. - Updated
code-rs/core/src/chat_completions.rsandcode-rs/core/src/client.rsto propagate provider hostnames, enrich idle-timeout/early-disconnect errors, and added an async regression test for early stream closure guidance. - Extended unit coverage in
code-rs/core/src/error.rsfor host-specific DNS hints, TLS failures, and connection resets.
Tests:
cargo test -p code-core dns_guidance_includes_host_details -- --nocapturecargo test -p code-core network_guidance_detects_connection_resets -- --nocapturecargo test -p code-core network_guidance_detects_tls_failures -- --nocapturecargo test -p code-core chat_completions::tests::early_disconnect_emits_guidance -- --nocapture./build-fast.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CodexErr::Streamwith actionable hints (e.g., check/etc/resolv.conf)Testing
Fixes #377.